<!DOCTYPE html>
<html lang="en"
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
      xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8">
    <title>添加帖子</title>
    <link rel="stylesheet" th:href="@{/layui-v2.6.4/layui/css/layui.css}" type="text/css"/>
    <link rel="stylesheet" th:href="@{/layui-v2.6.4/layui/css/modules/code.css}" type="text/css"/>
    <script th:src="@{/js/jquery-3.5.1.min.js}"></script>
    <script charset="utf-8" th:src="@{/layui-v2.6.4/layui/layui.js}" type="text/javascript"></script>
    <script>
        layui.use('element', function () {
            var element = layui.element;
        });
    </script>
    <style>
        body {
            height: 100%;
            /*background: linear-gradient(90deg, #C9CACB, #C9CACB, #C9CACB, #C9CACB, #C9CACB, #C9CACB, #C9CACB, #C9CACB, #C9CACB, #C9CACB, #C9CACB, #C9CACB, #C9CACB, #C9CACB);*/
        }
    </style>
</head>
<body>
<div class="div_top" th:replace="include/top"></div>
<div class="layui-container" style="height: 90%;width: 90%">
    <div class="layui-row" style=" width: 90%;height: 100%; ">


        <div class="layui-col-md10">
            <div class="layui-form-item">
                <br>
                <label class="layui-form-label">标题</label>

                <div class="layui-input-block">
                    <input autocomplete="off" class="layui-input" id="pname" name="pname" placeholder="添加帖子题目"
                           type="text">
                </div>
            </div>
        </div>
        <div class="layui-col-md2">
            <div class="layui-form-item">
                <br>
                <button class="layui-btn" lay-filter="demo2" onclick="resigned()">确认提交</button>
                <button class="layui-btn layui-btn-primary" type="reset">重置</button>
            </div>
        </div>
        <div class="layui-col-md10">
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">文本域</label>
                <div class="layui-input-block" id="md-content" style="z-index: 1 !important;">
                    <textarea class="layui-textarea" id="adminDec" name="adminDec" placeholder="添加帖子详细信息">



                    </textarea>
                </div>
            </div>
        </div>

    </div>
</div>
<script>

    function resigned() {
        $(window.parent.$("#jianjie").html($("#adminDec").val()));
        $(window.parent.$("#pname").html($("#pname").val()));
        $.ajax({
            url: "/addForum"
            , type: 'get'
            , async: false
            , data: {
                hidden: $("#hidden").val()
                , pname: $("#pname").val()
                , adminDec: $("#adminDec").val()
            }
            , success: function (a) {
                ac()
            }
        });
    }

    layui.use('laydate', function () {
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#test1' //指定元素
        });
    });

    function ac() {
        layui.use(['layer', 'form'], function () {
            var layer = layui.layer
                , form = layui.form;
            layer.msg('添加成功');

            location.assign("/toForumList")
        });
    }

    function timeout() {
        return true;
    }
</script>

</body>
</html>
